<template>
	<div>
		<Button type="primary" @click="reloadRouter" style="margin-bottom: 20px">刷新路由</Button>
		<Input v-model="router" :rows="30" type="textarea" placeholder="Enter something..." />
		<Button type="primary" @click="submit" style="margin-top: 20px">提交</Button>
	</div>
</template>

<script>
	export default {
		data () {
			return {
				router: ''
			}
		},
		methods: {
			submit () {
				this.$api.post(0, '/kuber/v2/containerDescription/config', {config: this.router}, r => {
					if (r.data.code === 0) {
						this.$Message.success('配置成功')
					}
				})
			},
			reloadRouter () {
				this.$api.post(0, '/kuber/v2/containerDescription/reboot', {}, r => {
					if (r.data.code === 0) {
						this.$Message.success('刷新成功')
					}
				})
			}
		},
		mounted () {
			this.$api.get(0, '/kuber/v2/containerDescription/config', {}, r => {
				if (r.data.code === 0) {
					this.router = r.data.data
				}
			})
		}
	}
</script>
